/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DAO;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;

/**
 *
 * @author Wolfgang
 */
@Entity
public class RaceResult {
    
    @Column(name="startNumber")
    private int startNumber;
    @Column(name="elapsedTime")
    private long elapsedTime; 
    @Column(name="firstName")
    private String firstName;
    @Column(name="lastName")
    private String lastName;
    @Column(name="tagId")
    private String tagId;
    @Column(name="loopcount")
    private long loopcount;
    
    public RaceResult(){
        super();
    }
   
    public RaceResult(long loopCount, long elapsedTime, String tagId, int startNumber, String firstName, String lastName){
        this.startNumber = startNumber;
        this.elapsedTime = elapsedTime;
        this.firstName = firstName;
        this.lastName = lastName;
        this.tagId = tagId;
        this.loopcount = loopCount;
    }

    public int getStartNumber() {
        return startNumber;
    }

    public void setStartNumber(int startNumber) {
        this.startNumber = startNumber;
    }

    public long getElapsedTime() {
        return elapsedTime;
    }

    public void setElapsedTime(long elapsedTime) {
        this.elapsedTime = elapsedTime;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getTagId() {
        return tagId;
    }

    public void setTagId(String tagId) {
        this.tagId = tagId;
    }

    public long getLoopcount() {
        if (loopcount > 0 ){
            return loopcount -1;
        }
        return loopcount;
    }

    public void setLoopcount(long loopcount) {
        this.loopcount = loopcount;
    }
    public String getTimeInMinutes(){
       
        long min = (this.elapsedTime)/60;
        long sec = (this.elapsedTime%60);
        long hours = min/60;
        min = min%60;
        return hours+":"+min+":"+sec;
    }
    
}